<?php
$this->load->helper ( "url" );
if(isset($height) && isset($width)){
	if($funcType==1){
		//if TwoImages
		if(isset($_SESSION["backgroundImageName"])){
			if(strcmp($_SESSION["backgroundImageName"], "defaultBackground.jpeg")==0){
				$size = getimagesize ( "./UserUploads/defaultBackground.jpeg" );
			}else{
				$size = getimagesize ( $_SESSION["backgroundPath"]);
			}
		}else{
			$size = getimagesize ( "./UserUploads/defaultBackground.jpeg" );
		}
		$standarWidth = $size[0]/5;
		$height = $height*$standarWidth/$width;
		$width = $standarWidth;
	}else{
		$height = $height*500/$width;
		$width = 500;
	}
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!-- BEGINNING OF HEAD -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<title>My Facebook App</title> 
<script type="text/javascript"
		src='<?php echo base_url()."style/ddtabmenu/ddtabmenufiles/ddtabmenu.js";?>'>
</script>

<link rel="stylesheet" type="text/css"
		href='<?php echo base_url()."style/ddtabmenu/ddtabmenufiles/ddtabmenu.css"; ?>'></link>

<script type="text/javascript">
	//	SYNTAX: ddtabmenu.definemenu("tab_menu_id", integer OR "auto")
	ddtabmenu.definemenu("ddtabs1", <?php echo $funcType?>) //initialize Tab Menu #1 with 1st tab selected
</script>

<!-- Script for color picker -->
<script type="text/javascript"
	src=<?php echo base_url()."style/jscolor/jscolor.js"?>>
</script>
	
<!-- for angle picker -->
<link rel="stylesheet" type="text/css" 
href=<?php if($funcType!=5) echo base_url()."style/anglepicker/ui.anglepicker.css"; ?>>

<link rel="stylesheet" type="text/csss" 
href=<?php if($funcType==0) echo base_url()."style/Watermark.css"; ?>>

<script type="text/javascript" src=<?php echo base_url()."style/anglepicker/vendor/jquery-1.9.1.js"; ?>></script>
<script type="text/javascript" src=<?php if($funcType==0) echo base_url()."style/Watermark.js"; ?>></script>
<script type="text/javascript" src=<?php echo base_url()."style/anglepicker/vendor/jquery-ui-1.10.2.js"; ?>></script>
<script type="text/javascript" src=<?php echo base_url()."style/anglepicker/ui.anglepicker.js"; ?>></script>


<link rel="stylesheet" type="text/css"
	href="<?php if($funcType==1) echo base_url()."/style/TwoImagesStyle.css"?>">
<script language="JavaScript" type="text/javascript" src="<?php if($funcType==1) echo base_url()."/style/TwoImagesStyle.js"?>"></script>

<link rel="stylesheet" type="text/css"
	href="<?php if($funcType==2) echo base_url()."/style/FrameStyle.css"?>">
<script language="JavaScript" type="text/javascript"
	src="<?php if($funcType==2) echo base_url()."/style/FrameStyle.js"?>"></script>

<link rel="stylesheet" type="text/css"
	href="<?php if($funcType==5) echo base_url()."/style/FunnyEffect.css"?>">
<script language="JavaScript" type="text/javascript"
	src="<?php if($funcType==5) echo base_url()."/style/FunnyEffect.js"?>"></script>

<!-- spinner-image for upload -->
<script type="text/javascript" src='<?php echo base_url()."style/imageSpinner/script.js"?>'></script>
<link rel="stylesheet" type="text/css" href='<?php echo base_url()."style/imageSpinner/style.css"?>'>

<script type="text/javascript">
// sets two variables to store the X and Y position
var xpos; var ypos;

$(document).ready(function() {
  // sets draggable the element with id="dg"
  $('#watermarkcontent').draggable({
    // get the INITIAL X and Y position when dragging starts
    start: function(event, ui) {
    	xpos = ui.position.left;
      	ypos = ui.position.top;
    },
    	// when dragging stops
    stop: function(event, ui) {
//       	alert('The DIV was moved,\n\n'+ xd+ xmove+ ' pixels \n'+ yd+ ymove+ ' pixels');
//       	alert('current X position is: ' + ui.position.left + ' current Y position is: ' + ui.position.top);
      	document.getElementById("watermarkPositionX").value = ui.position.left;
      	document.getElementById("watermarkPositionY").value = ui.position.top;
    },

    // sets draggable the elements with id="im"
    cursor: 'move',        // sets the cursor apperance
    containment: '#outerWatermark'    // sets to can be dragged only within "#drg" element
  });
});
</script>


<script type="text/javascript">
// sets two variables to store the X and Y position
var xpos; var ypos;
$(document).ready(function() {
  // sets draggable the element with id="dg"
  $('#mainImage').draggable({
    // get the INITIAL X and Y position when dragging starts
    start: function(event, ui) {
    	xpos = ui.position.left;
      	ypos = ui.position.top;
    },
    	// when dragging stops
    stop: function(event, ui) {
//       	alert('The DIV was moved,\n\n'+ xd+ xmove+ ' pixels \n'+ yd+ ymove+ ' pixels');
//       	alert('current X position is: ' + ui.position.left + ' current Y position is: ' + ui.position.top);
      	document.getElementById("imagePositionX").value = ui.position.left;
      	document.getElementById("imagePositionY").value = ui.position.top;
    },

    // sets draggable the elements with id="im"
    cursor: 'move',        // sets the cursor apperance
    containment: '#outer'    // sets to can be dragged only within "#drg" element
  });
});
</script>

<!-- Watermark -->
<style>
	body{
		margin: 0;
		background: #E9EAEE;
	}
	#outerWatermark{
	    position: relative;
	    background: url(<?php echo $imageName;?>) no-repeat;
	    background-size: <?php echo $width."px"?> <?php echo $height."px"?>; 
	    width: <?php echo $width."px"?>;
	    height: <?php echo $height."px"?>;
	}
	
	#watermarkcontent {
	    position: absolute;
	    top: 1em;
	    left: 2em;
	    height: 30px;
	    width: 120px;
	    padding: 4px;
	    background-color: #fff;
	    font-weight: bold;
	    font-size: 11px;
	    
  	}
	
</style>
	
<!-- Two Images -->
<style>
	#outer{
	    position: relative;
	    background: url(<?php echo 
	    (isset($_SESSION["backgroundChanged"]))
	    ?($_SESSION["backgroundPath"])
	    :((isset($_SESSION["isTwoImages"])?($_SESSION["twoImagesPath"])//change image
	    :((!isset($_SESSION["backgroundImageName"]))?//first time
		(base_url()."UserUploads/defaultBackground.jpeg"):
		((strcmp($_SESSION["backgroundImageName"], "defaultBackground.jpeg")==0)?
		(base_url()."UserUploads/defaultBackground.jpeg"):
		($_SESSION["backgroundPath"] )))));?>) no-repeat;
		
	    <?php
		    if(isset($_SESSION["backgroundImageName"])){
				if(strcmp($_SESSION["backgroundImageName"], "defaultBackground.jpeg")==0){	
					$size = getimagesize ( "./UserUploads/defaultBackground.jpeg" );
					echo "width: ".$size[0]."px;";
					echo "height: ".$size[1]."px;";	
				}else{
		    		$size = getimagesize ( $_SESSION["backgroundPath"]);	
		    		echo "width: ".$size[0]."px;";
		    		echo "height: ".$size[1]."px;";
		    	}
		    }else{
				$size = getimagesize ( "./UserUploads/defaultBackground.jpeg" );
				echo "width: ".$size[0]."px;";
				echo "height: ".$size[1]."px;";
	 		}
	    ?>;
	    <?php if(isset($_SESSION["backgroundChanged"]))
			unset($_SESSION["backgroundChanged"])?>;
	}
	
	#mainImage {
		background: url(<?php echo $imageName;?>) no-repeat;
		background-size:<?php 
							echo $width."px";
							
						?> 
						<?php 
							echo $height."px";
						?>;
		width: <?php echo $width."px"?>;
	    height: <?php echo $height."px"?>;
	    position: absolute;
	    top: 1em;
	    left: 2em;
	    padding: 4px;
	    background-color: #fff;
	    font-weight: bold;
	    font-size: 11px;
  	}
	
	#ddtabs1{
		z-index: 9999;
		position: fixed;
		background: #44619B;
		width: 100%;
		height: 40px;
	}
	#ddtabs1 ul{
		margin-top: 10px;
	}
	#FacebookLogin a{
		text-decoration: none;
		color: #FFFFFF;
		font-weight: bold;
		line-height: 40px;
		padding-bottom: 0;
	 	margin-bottom:0;
	}
	#FacebookLogin img{
		width: 30px;
		height: 30px;
	}
	.tabcontainer{
		padding-top: 41px;
	}
</style>

</head>
<!-- END OF HEAD -->

<!-- BEGINNING OF BODY -->
<body>

	<div id="ddtabs1" class="basictab">
		<ul>
			<li><a title="watermark your image" onclick="loadAjax();"
				href=<?php echo "'".base_url("index.php/FunctionWatermark/Watermark")."'"?>
				rel="Watermark">Đóng dấu ảnh</a></li>
			<li><a title="add background to your images" onclick="loadAjax();"
				href=<?php echo "'".base_url("index.php/FunctionTwoImages/TwoImages")."'"?>
				rel="TwoImages">Ghép ảnh nền</a></li>
			<li><a title="beautiful frames for your pictures" onclick="loadAjax();"
				href=<?php echo "'".base_url("index.php/FunctionFrame/Frame")."'"?>
				rel="Frames">Khung ảnh</a></li>
			<li><a title="look like cartoon pictures" onclick="loadAjax();"
				href=<?php echo "'".base_url("index.php/FunctionCartoon/Cartoon")."'"?>
				rel="Cartoon">Ảnh hoạt hình</a></li>
			<li><a display="none"></a></li>
			<li><a title="make yourself looks like superman, ..." onclick="loadAjax();"
				href=<?php echo "'".base_url("index.php/FunctionFunnyEffect/FunnyEffect")."'"?>
				rel="FunnyEffect">Hiệu ứng vui</a></li>
			<li><a title="make your picture in pencil" onclick="loadAjax();"
				href=<?php echo "'".base_url("index.php/FunctionSketch/Sketch")."'"?>
				rel="Sketch">Ảnh chì</a></li>
		</ul>

		<div id="FacebookLogin">
				<?php
					echo "<a href='";
					if (! isset ( $_SESSION ["userId"] ))
						echo "http://localhost/ImageProcessing/index.php/FacebookLogin/FacebookLogin";
					else if (strcmp ( $_SESSION ["userName"], "Anonymous" ) == 0)
						echo "http://localhost/ImageProcessing/index.php/FacebookLogin/FacebookLogin";
					else
						echo "http://facebook.com/me";
					echo "'>";
					echo "<img src='";
					echo $_SESSION["profilePicture"]."'";
					echo "/>";
					echo "<span>";
					echo $_SESSION ["userName"];
					echo "</span>";
					echo "</a>";
				?>
				<?php
				
				if (! isset ( $_SESSION ["userId"] )) {
					echo "<img src = ";
					echo base_url () . "/UserUploads/fb-login.jpg";
					echo "></img>";
				} else {
					if (strcmp ( $_SESSION ["userName"], "Anonymous" ) == 0) {
						echo "<img src = ";
						echo base_url () . "/UserUploads/fb-login.jpg";
						echo "></img>";
					} else {
						echo "<a class='logout' href=" . base_url ( "/index.php/FacebookLogout/FacebookLogout" ) . " style='padding-left:10px'>";
						echo "Logout";
						echo "</a>";
					}
				}
				?>	
			</a>
		</div>
	</div>

	<div class="tabcontainer">
		<div id="Watermark" class="tabcontent">
			<?php
				if($funcType==0){
					echo "<div id='outerWatermark'>";
					echo "<div id='watermarkcontent'>";
					echo "Đóng dấu ảnh</div>";
					echo "</div>";
					
					echo "<form method='post' action='";
					echo base_url()."index.php/FunctionWatermark/Watermark/process'>";
					
					echo "<table>";
					
					echo "<tr>";
					echo "<td>";
					echo "<label for='watermarkImage'>Nội dung đóng dấu: </label>";
					echo "</td>";
					echo "<td>";
					echo "<input id='watermarkImage' name='watermarkImage' onkeyup='copyvalue(this)'>";
					echo "</td>";
					echo "</tr>";
					echo "<tr>";
					echo "<td>";
					echo "<label for='watermarkPositionX'>Hoành độ X: </label>";
					echo "</td>";
					echo "<td>";
					echo "<input readOnly id='watermarkPositionX' name='coordinateX' value='0'></input>";
					echo "</td>";
					echo "</tr>";
					
					echo "<tr>";
					echo "<td>";
					echo "<label for='watermarkPositionY'>Tung độ Y: </label>";
					echo "</td>";
					echo "<td>";
					echo "<input readOnly id='watermarkPositionY' name='coordinateY' value='0'></input>";
					echo "</td>";
					echo "</tr>";
					
					echo "<tr>";
					echo "<td>";
					echo "<label for='watermarkColor'>Màu: </label>";
					echo "</td>";
					echo "<td>";
					echo "<input class='color' name='color' id='watermarkColor'";
					echo "</td>";
					echo "</tr>";
					
					echo "<tr>";
					echo "<td>";
					echo "<label for='angle'>Góc: </label></label>";
					echo "</td>";
					echo "<td>";
					echo "<div class='angle-container'>";
					echo "<div id='anglepicker'></div>";
					echo "</div>";
					echo "</div>";
					echo "<input readOnly name='angle' id='angle'>";
					echo "</td>";
					echo "</tr>";
					
					echo "</table>";
					
					echo "<input type='submit' value='Xem trước' onclick='loadAjax();'>";
					echo "</form>";
					
					echo "<a href='";
					echo base_url("/index.php/FacebookPost/FacebookPost/index?funcType=0")."'>";
					echo "<input type='button' value='Đăng lên Facebook' onclick='loadAjax();'>";
					echo "</a>";
					
					echo $this->session->flashdata('Error');
				}else{
					echo "Watermark";
				}
			?>
		</div>

		<div id="TwoImages" class="tabcontent">
			<?php
				if($funcType==1){
					echo "<div id='outer'>";
					echo "<div id='mainImage'>";
					echo "</div>";
					echo "</div>";
					
					echo "<form action='";
					echo base_url()."index.php/FunctionTwoImages/TwoImages/backgroundProcess'";
					echo "enctype='multipart/form-data' method='post'>";
					echo "<table>";
					echo "<tr>";
					echo "<td>";
					echo "<label for='backgroundImage'>Ảnh nền: </label>";
					echo "</td>";
					echo "<td>";
					echo "<input  type='file' id='backgroundImage' name='backgroundImage'></input>";
					echo "<input type='submit' value='Dùng ảnh này làm nền' onclick='loadAjax();'></input>";
					echo "</td>";
					echo "</tr>";
					echo "</table>";
					echo "</form>";
					
					echo "<form method='post'";
					echo "action = '".base_url()."index.php/FunctionTwoImages/TwoImages/process'";
					echo "enctype='multipart/form-data'>";
					
					echo "<table>";
					
					echo "<tr>";
					echo "<td>";
					echo "<label for='backgroundName'> Ảnh nền: </label>";
					echo "</td>";
					echo "<td>";
					echo "<input readOnly id='backgroundName' name='backgroundName' value='";
					echo isset($_SESSION["backgroundImageName"])?$_SESSION["backgroundImageName"]:"defaultBackground.jpeg";
					echo "'";
					echo "</td>";
					echo "</tr>";
					
					echo "<tr>";
					echo "<td>";
					echo "<label for='imagePositionX'>Hoành độ X:</label>";
					echo "</td>";
					echo "<td>";
					echo "<input readOnly id='imagePositionX' name='imagePositionX' value='0'></input>";
					echo "</td>";
					echo "</tr>";
					
					echo "<tr>";
					echo "<td>";
					echo "<label for='imagePositionY'>Tung độ Y:</label>";
					echo "</td>";
					echo "<td>";
					echo "<input readOnly id='imagePositionY' name='imagePositionY' value='0'></input>";
					echo "</td>";
					echo "</tr>";
					
					echo "<tr>";
// 					echo "<td>";
// 					echo "<label>Image Style: </label>";
// 					echo "</td>";
					echo "<td>";
					echo "<div id='image-dropdown' style='display:none'>";
					echo "<input checked='checked' type='radio' id='line1' name='line-style' value='1'/>";
					echo "<label for='line1'></label>";
					echo "<input type='radio' id='line2' name='line-style' value='2'/>";
					echo "<label for='line2'></label>";
					echo "<input type='radio' id='line3' name='line-style' value='3'/>";
					echo "<label for='line3'></label>";
					echo "<input type='radio' id='line4' name='line-style' value='4'/>";
					echo "<label for='line4'></label>";
					echo "<input type='radio' id='line5' name='line-style' value='5'/>";
					echo "<label for='line5'></label>";
					echo "<input type='radio' id='line6' name='line-style' value='6'/>";
					echo "<label for='line6'></label>";
					echo "<input type='radio' id='line7' name='line-style' value='7'/>";
					echo "<label for='line7'></label>";
					echo "<input type='radio' id='line8' name='line-style' value='8'/>";
					echo "<label for='line8'></label>";
					echo "<input type='radio' id='line9' name='line-style' value='9'/>";
					echo "<label for='line9'></label>";
					echo "<input type='radio' id='line10' name='line-style' value='10'/>";
					echo "<label for='line10'></label>";
					echo "<input type='radio' id='line11' name='line-style' value='11'/>";
					echo "<label for='line11'></label>";
					echo "<input type='radio' id='line12' name='line-style' value='12'/>";
					echo "<label for='line12'></label>";
					echo "<input type='radio' id='line13' name='line-style' value='13'/>";
					echo "<label for='line13'></label>";
					echo "<input type='radio' id='line14' name='line-style' value='14'/>";
					echo "<label for='line14'></label>";
					echo "<input type='radio' id='line15' name='line-style' value='15'/>";
					echo "<label for='line15'></label>";
					echo "<input type='radio' id='line16' name='line-style' value='16'/>";
					echo "<label for='line16'></label>";
					echo "<input type='radio' id='line17' name='line-style' value='17'/>";
					echo "<label for='line17'></label>";
					echo "<input type='radio' id='line18' name='line-style' value='18'/>";
					echo "<label for='line18'></label>";
					echo "<input type='radio' id='line19' name='line-style' value='19'/>";
					echo "<label for='line19'></label>";
					echo "</div>";
					echo "</td>";
					echo "</tr>";
					echo "</table>";
					echo "<input type='submit' value='Xem trước' onclick='loadAjax();'>";
					echo "</form>";
					
					
					echo "<a href='";
					echo base_url("/index.php/FacebookPost/FacebookPost/index?funcType=1")."'>";
					echo "<input type='button' value='Đăng lên Facebook' onclick='loadAjax();'>";
					echo "</a>";
					echo $this->session->flashdata('Error');
					
				}else{
					echo "TwoImages";
				}
			?>
		</div>

		<div id="Frames" class="tabcontent">
			<?php
				if($funcType==2){
					echo "<img src='";
					echo $imageName."'";
					echo "alt='resizeimg' width=500 height=$height*500/$width[0]>";
					echo "</br> </br>";
					
					echo "<form method='post' action='";
					echo base_url()."index.php/FunctionFrame/Frame/process"."'>";
					
					echo "<div id='image-dropdown'>";
					echo "<input checked='checked' type='radio' id='line1' name='line-style' value='1'>";
					echo "<label for='line1'></label>";
					echo "<input type='radio' id='line2' name='line-style' value='2'>";
					echo "<label for='line2'></label>";
					echo "<input type='radio' id='line3' name='line-style' value='3'>";
					echo "<label for='line3'></label>";
					echo "<input type='radio' id='line4' name='line-style' value='4'>";
					echo "<label for='line4'></label>";
					echo "<input type='radio' id='line5' name='line-style' value='5'>";
					echo "<label for='line5'></label>";
					echo "<input type='radio' id='line6' name='line-style' value='6'>";
					echo "<label for='line6'></label>";
					echo "<input type='radio' id='line7' name='line-style' value='7'>";
					echo "<label for='line7'></label>";
					echo "<input type='radio' id='line8' name='line-style' value='8'>";
					echo "<label for='line8'></label>";
					echo "<input type='radio' id='line9' name='line-style' value='9'>";
					echo "<label for='line9'></label>";
					echo "<input type='radio' id='line10' name='line-style' value='10'>";
					echo "<label for='line10'></label>";
					echo "<input type='radio' id='line11' name='line-style' value='11'>";
					echo "<label for='line11'></label>";
					echo "<input type='radio' id='line12' name='line-style' value='12'>";
					echo "<label for='line12'></label>";
					echo "<input type='radio' id='line13' name='line-style' value='13'>";
					echo "<label for='line13'></label>";
					echo "<input type='radio' id='line14' name='line-style' value='14'>";
					echo "<label for='line14'></label>";
					echo "</div>";
					echo "<input type='submit' value='Xem trước' onclick='loadAjax();'>";
					echo "</form>";
					
					echo "<a href='";
					echo base_url("/index.php/FacebookPost/FacebookPost/index?funcType=2")."'>";
					echo "<input type='button' value='Đăng lên Facebook' onclick='loadAjax();'></a>";
					echo $this->session->flashdata('Error');
				}else{
					echo "Frames";
				}
			?>
		</div>

		<div id="Cartoon" class="tabcontent">
		
			<?php 
				if($funcType==3){
					echo "<img";
					echo " src='";
					echo $_SESSION["cartoonPath"]."'";
					echo "alt='resizeimg' width=500 height=$height*500/$width[0]>";
					echo "</br>";

					echo "<a ";
					echo "href=' ";
					echo base_url("/index.php/FacebookPost/FacebookPost/index?funcType=3")."'>";
					echo "<input ";
					echo "type='button' ";
					echo "value='Đăng lên Facebook' onclick='loadAjax();'>";
					echo "</input>";
					echo "</a>";
				}else{
					echo "Cartoon";
				}
			?>
		
		</div>

		<div id="OldAge" class="tabcontent">
			<?php
				if($funcType==4){
					
				}else{
					echo "OldAge";
				}
			?>
		</div>
		<div id="FunnyEffect" class="tabcontent">
			<?php 
				if($funcType==5){
					echo "<img src='";
					echo $imageName."'";
					echo "alt='resizeImg' width='$width' height='$height'>";
					echo "</br></br>";
					
					echo "<form method='post' action='";
					echo base_url()."index.php/FunctionFunnyEffect/FunnyEffect/process"."'>";
					
					echo "<div class='image-dropdown' id='beard'>";
					
					echo "<input checked='checked' type='radio' id='line0' name='beard-style' value='0'/>";
					echo "<label for='line0'></label>";
					echo "<input type='radio' id='line1' name='beard-style' value='1'/>";
					echo "<label for='line1'></label>";
					echo "<input type='radio' id='line2' name='beard-style' value='2'/>";
					echo "<label for='line2'></label>";
					echo "<input type='radio' id='line3' name='beard-style' value='3'/>";
					echo "<label for='line3'></label>";
					echo "<input type='radio' id='line4' name='beard-style' value='4'/>";
					echo "<label for='line4'></label>";
					echo "<input type='radio' id='line5' name='beard-style' value='5'/>";
					echo "<label for='line5'></label>";
					echo "<input type='radio' id='line6' name='beard-style' value='6'/>";
					echo "<label for='line6'></label>";
					echo "<input type='radio' id='line7' name='beard-style' value='7'/>";
					echo "<label for='line7'></label>";
					echo "<input type='radio' id='line8' name='beard-style' value='8'/>";
					echo "<label for='line8'></label>";
					echo "<input type='radio' id='line9' name='beard-style' value='9'/>";
					echo "<label for='line9'></label>";
					echo "<input type='radio' id='line10' name='beard-style' value='10'/>";
					echo "<label for='line10'></label>";
					echo "<input type='radio' id='line11' name='beard-style' value='11'/>";
					echo "<label for='line11'></label>";
					echo "<input type='radio' id='line12' name='beard-style' value='12'/>";
					echo "<label for='line12'></label>";
					
					echo "</div>";
					
					echo "<div class='image-dropdown' id='hair'>";
					echo "<input checked='checked' type='radio' id='line30' name='hair-style' value='0'/>";
					echo "<label for='line30'></label>";
					echo "<input type='radio' id='line13' name='hair-style' value='1'/>";
					echo "<label for='line13'></label>";
					echo "<input type='radio' id='line14' name='hair-style' value='2'/>";
					echo "<label for='line14'></label>";
					echo "<input type='radio' id='line15' name='hair-style' value='3'/>";
					echo "<label for='line15'></label>";
					echo "<input type='radio' id='line16' name='hair-style' value='4'/>";
					echo "<label for='line16'></label>";
					echo "<input type='radio' id='line17' name='hair-style' value='5'/>";
					echo "<label for='line17'></label>";
					echo "<input type='radio' id='line18' name='hair-style' value='6'/>";
					echo "<label for='line18'></label>";
					echo "<input type='radio' id='line19' name='hair-style' value='7'/>";
					echo "<label for='line19'></label>";
					echo "<input type='radio' id='line20' name='hair-style' value='8'/>";
					echo "<label for='line20'></label>";
					echo "<input type='radio' id='line21' name='hair-style' value='9'/>";
					echo "<label for='line21'></label>";
					echo "<input type='radio' id='line22' name='hair-style' value='10'/>";
					echo "<label for='line22'></label>";
					echo "<input type='radio' id='line23' name='hair-style' value='11'/>";
					echo "<label for='line23'></label>";
					echo "</div>";
					
					echo "<div class='image-dropdown' id='nose'>";
					echo "<input checked='checked' type='radio' id='line31' name='nose-style' value='0'/>";
					echo "<label for='line31'></label>";
					echo "<input type='radio' id='line24' name='nose-style' value='1'/>";
					echo "<label for='line24'></label>";
					echo "<input type='radio' id='line25' name='nose-style' value='2'/>";
					echo "<label for='line25'></label>";
					echo "<input type='radio' id='line26' name='nose-style' value='3'/>";
					echo "<label for='line26'></label>";
					echo "<input type='radio' id='line27' name='nose-style' value='4'/>";
					echo "<label for='line27'></label>";
					echo "<input type='radio' id='line28' name='nose-style' value='5'/>";
					echo "<label for='line28'></label>";
					echo "</div>";
					
					echo "<input type='submit' value='Xem trước' class='submit' onclick='loadAjax();'>";
					echo "</form>";
					
					echo "<a href='";
					echo base_url("/index.php/FacebookPost/FacebookPost/index?funcType=5")."'>";
					echo "<input type='button' value='Đăng lên Facebook' onclick='loadAjax();'/>";
					echo "</a>";
					
					echo $this->session->flashdata('Error');
				}else{
					echo "FunnyEffect";
				}
			?>
		</div>
		<div id="Sketch" class="tabcontent">
		
			<?php 
				if($funcType==6){
					echo "<img";
					echo " src='";
					echo $_SESSION["sketchPath"]."'";
					echo "width='$width' ";
					echo "height='$height'/> ";
					echo "</br>";

					echo "<a ";
					echo "href=' ";
					echo base_url("/index.php/FacebookPost/FacebookPost/index?funcType=6")."'>";
					echo "<input ";
					echo "type='button' ";
					echo "value='Đăng lên Facebook' onclick='loadAjax();'>";
					echo "</input>";
					echo "</a>";
				}else{
					echo "Sketch";
				}
			?>
		
		</div>
	</div>

	
	<div class="imageupload">
		<img
			src='<?php
			if (isset($_SESSION["imagePath"]))
				echo $_SESSION["imagePath"];
			else
				echo base_url () . "UserUploads/default.jpg";
			
			?>'
			<?php
			if (!isset($_SESSION["imagePath"])) {
				$userId = $_SESSION ["userId"];
				$imageName = "default.jpg";
				$imgSize = getimagesize ( "./UserUploads/$userId/$imageName" );
			} else{
				$imgSize = getimagesize ($_SESSION["imagePath"]);
			}	
			echo "alt='resizeimg' width=200 height=$imgSize[1]*200/$imgSize[0]";
			?> />
					
		<form id="imageUpload" method="post" enctype="multipart/form-data"
			action='<?php echo base_url("index.php/ImageUpload/ImageUpload/process");?>'>
			<label for="image">Chọn ảnh</label> <br>
			<input type="file"
				id="imageUpload" name="imageUpload"></input> </br>
			<input type="submit" onclick="loadAjax();"
				value="Đăng ảnh"></input>
		
		</form>
			<?php
			echo $this->session->flashdata ( 'Error' );
			?>
		<div id="content">
			<div id="results"><!-- Results are displayed here --></div>
			<div id="fade"></div>
			<div id="modal">
				<img id="loader" src="<?php echo base_url()."style/imageSpinner/"?>images/loading.gif" />
			</div>
		</div>
	</div>
</body>
<!-- END OF BODY -->
</html>
